﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using Microsoft.Xna.Framework;
using Microsoft.Xna.Framework.Graphics;

namespace SimplexEngine
{
    public class MRTDirectionLightMaterial : MRTLightMaterial
    {
        public MRTDirectionLightMaterial()
        {
            effect = Root.Instance.ContentSystem.GetResource("MRTDirectionLight.Shader");
        }

        protected override void OnApplyParameters(GameTime game_time, Int64 frame_number)
        {
            base.OnApplyParameters(game_time, frame_number);
            Effect.Parameters["InvertLightDirection"].SetValue(Vector3.Normalize(-direction));
        }

        public Vector3 Direction { get { return direction; } set { direction = value; } }
        protected Vector3 direction = new Vector3(0.0f, -1.0f, 0.0f);

        public override Material Clone()
        {
            MRTDirectionLightMaterial material = new MRTDirectionLightMaterial();
            material.direction = direction;
            material.diffuse = diffuse;
            material.normal_texture = normal_texture;
            return material;
        }
    }
}
